package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.Plan;
import com.indusfo.spc.pojo.PlanBatchno;
import com.indusfo.spc.service.PlanBatchnoService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 任务单分解批次控制层
 */
@Controller
@RequestMapping("/planBatchno")
public class PlanBatchnoController {

    @Autowired
    private PlanBatchnoService planBatchnoService;

    /**
     * 新增任务单分解批次
     *
     * @param planBatchno
     * @return
     */
    @RequestMapping(value = "/insertPlanBatchno")
    @SystemControllerLog(description="新增任务单分解批次")
    @ResponseBody
    public JSONObject insertPlanBatchno (PlanBatchno planBatchno , Integer num){

        JSONObject json=planBatchnoService.insertPlanBatchno(planBatchno , num);

        return json;
    }

    /**
     * 查询
     *
     * @param
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/queryPlanBatchno")
    @SystemControllerLog(description="查询")
    @ResponseBody
    public JSONObject queryPlanBatchno(PlanBatchno planBatchno) {

        JSONObject json = planBatchnoService.selectPlanBatchno(planBatchno);
        return json;

    }

    /**
     * 查询任务单
     *
     * @param
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/queryPlan")
    @SystemControllerLog(description="查询")
    @ResponseBody
    public JSONObject queryPlan(Plan plan) {

        JSONObject json = planBatchnoService.queryPlan(plan);
        return json;

    }


    /**
     * 删除
     *
     * @param
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/delPlanBatchno")
    @SystemControllerLog(description="删除")
    @ResponseBody
    public JSONObject delPlanBatchno(Long[] PlanBatchnoIds) {

        JSONObject json = planBatchnoService.delPlanBatchno(PlanBatchnoIds);
        return json;

    }

    /**
     * 打印
     *
     * @param
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/printPlanBatchno")
    @SystemControllerLog(description="打印")
    @ResponseBody
    public JSONObject printPlanBatchno(Long[] PlanBatchnoIds) {

        JSONObject json = planBatchnoService.printPlanBatchno(PlanBatchnoIds);
        return json;

    }

    /**
     * 查询个数
     *
     * @param
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/numPlanBatchno")
    @SystemControllerLog(description="查询个数")
    @ResponseBody
    public JSONObject numPlanBatchno(PlanBatchno planBatchno) {

        JSONObject json = planBatchnoService.numPlanBatchno(planBatchno);
        return json;

    }

}
